package v.book.read.tip.decorator.practice;

import junit.framework.TestCase;

interface SkillComponent {
	String skill();
}

class Bird implements SkillComponent {

	public String skill() {
		return "Bird";
	}
	
}

abstract class Decorator implements SkillComponent {
	
	private SkillComponent skill;
	
	public Decorator(SkillComponent skill) {
		this.skill = skill;
	}
	
	public String skill() {
		return skill.skill();
	}
}

class Fly extends Decorator {

	public Fly(SkillComponent skill) {
		super(skill);
	}
	
	public String skill() {
		return super.skill() + " Fly";
	}

}

class Swimming extends Decorator {

	public Swimming(SkillComponent skill) {
		super(skill);
	}
	
	@Override
	public String skill() {
		return super.skill() + " Swimming";
	}
	
}

public class PracticeBird extends TestCase {
	
	public void testBird() {
		SkillComponent bird = new Swimming(new Fly(new Bird()));
		System.out.println(bird.skill());
	}
	
	public static void main(String[] args) {
		junit.textui.TestRunner.run(PracticeBird.class);
	}
	

}
